<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
div{ width:100px; height:100px; border:red solid 1px; padding:30px;}
.div2{ -moz-box-sizing:border-box;box-sizing:border-box;}	
.div3{ -moz-box-sizing:content-box;box-sizing:content-box;}
</style>

</head>

<body>
<div class="div1">div</div>
<div class="div2">border-box</div>
<div class="div3">content-box</div>

<!--兼容IE6/7 border-box -->
<!--[if lt IE 8 ]>
<script>
    var borderBoxModel=function(l,d){function m(){e=parseInt(b.width,10)||parseInt(a.width,10);f=parseInt(b.height,10)||parseInt(a.height,10);if(e){var c=parseInt(b.borderLeftWidth||a.borderLeftWidth,10)||0,g=parseInt(b.borderRightWidth||a.borderRightWidth,10)||0,h=parseInt(b.paddingLeft||a.paddingLeft,10),i=parseInt(b.paddingRight||a.paddingRight,10);if(c=c+h+i+g)a.width=e-c}if(f){c=parseInt(b.borderTopWidth||a.borderTopWidth,10)||0;g=parseInt(b.borderBottomWidth||a.borderBottomWidth,10)||0;h=parseInt(b.paddingTop||a.paddingTop,10);i=parseInt(b.paddingBottom||a.paddingBottom,10);if(c=c+h+i+g)a.height=f-c}}for(var j,b,a,e,f,k=0,n=l.length;k<n;k++){j=l[k];a=j.style;b=j.currentStyle;if(a.boxSizing==d||a["box-sizing"]==d||b.boxSizing==d||b["box-sizing"]==d)try{m()}catch(e){}}}(document.getElementsByTagName("*"),"border-box");
</script>
<![endif]-->
</body>
</html>
